object ActivityAudit extends App {
  case class Student(
                      name: String,
                      isCompMajor: Boolean, progScore: Int, weeklyHours: Int, hasFail: Boolean,
                      hasArt: Boolean, canRehearse: Boolean, grade: Int,
                      peScore: Int, hasIllness: Boolean, run1000m: Int
                    )
  def check(student: Student): Unit = {
    println(s"=== ${student.name} 的审核结果 ===")
    val progOk = student.isCompMajor || student.progScore >= 85 &&
      student.weeklyHours >= 10 && !student.hasFail
    val progReason = if (!progOk)
      (if (!student.isCompMajor && student.progScore < 85) "非计算机专业且成绩不足85"
      else if (student.weeklyHours < 10) "每周时间不足10小时"
      else "有挂科记录") else ""
    val artOk = student.hasArt && student.canRehearse && student.grade <= 2
    val artReason = if (!artOk)
      (if (!student.hasArt) "无文艺特长"
      else if (!student.canRehearse) "无法参加排练"
      else "非大一大二") else ""
    val athOk = student.peScore >= 80 && !student.hasIllness && student.run1000m <= 264
    val athReason = if (!athOk)
      (if (student.peScore < 80) "体育成绩不足80"
      else if (student.hasIllness) "有重大疾病史"
      else "1000米不达标") else ""
    println(s"可参与: ${List(
      if (progOk) "编程大赛" else "",
      if (artOk) "文艺汇演" else "",
      if (athOk) "田径运动会" else ""
    ).filter(_.nonEmpty).mkString(", ")}")
    if (!progOk) println(s"- 编程大赛: $progReason")
    if (!artOk) println(s"- 文艺汇演: $artReason")
    if (!athOk) println(s"- 田径运动会: $athReason")
    println()
  }

  List(
    Student("孙七", true, 90, 15, false, true, true, 2, 85, false, 250),
    Student("张三", true, 95, 12, false, false, false, 3, 70, true, 300),
    Student("李四", false, 80, 5, true, true, true, 1, 75, false, 280),
    Student("王五", false, 80, 8, true, false, false, 3, 88, false, 260),
    Student("赵六", false, 80, 5, true, false, false, 3, 70, true, 300)
  ).foreach(check)
}